package com.example.demo3.controller;

import com.example.demo3.entity.Employee;
import com.example.demo3.entity.User;
import com.example.demo3.mapper.UserMapper;
import com.example.demo3.service.EmployeeService;
import com.example.demo3.util.ResBean;
import com.example.demo3.util.ResBeanUtil;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class EmployeeController {
    @Resource
    private UserMapper employeeService;

    @ResponseBody
    @GetMapping(value = "/aa")
    public ResBean finAll(Model model) {
        List<User> employee = employeeService.find();
        model.addAttribute("user",employee);
        return ResBeanUtil.success(employee);
    }

    @RequestMapping("/main")
    public String main(){
        return "main.jsp";
    }
    
}
